package com.example.springbootdemo.constant;

import lombok.Data;

/**
 * @author Gong.Yang
 */
public enum ErrCode {
    NOTFOUND("404","你是不是迷路啦~"),
    USER_INVALID("30001", "用户信息不完整:%s"),
    ;
    private String code;
    private String msg;

    ErrCode(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public BaseException getException() {
        return new BaseException(code, msg);
    }

    public BaseException getException(String content) {
        return new BaseException(code, String.format(msg, content));
    }
}
